package ltd.itlover.yqblog.network;

import io.reactivex.Observable;
import ltd.itlover.yqblog.dto.Result;
import ltd.itlover.yqblog.entity.User;
import okhttp3.MultipartBody;
import okhttp3.RequestBody;
import retrofit2.Response;
import retrofit2.http.Body;
import retrofit2.http.GET;
import retrofit2.http.Multipart;
import retrofit2.http.POST;
import retrofit2.http.Part;

public interface AccountApiService {
    @POST("/account/login")
    Observable<Response<Result<String>>> login(@Body User user);
    @GET("/account/logout")
    Observable<Result<String>> logout();

    @POST("/account/")
    Observable<Result<String>> register(@Body User user);

    @GET("/account/myInfo")
    Observable<Result<User>> getInfo();

    /**
     * 头像上传
     * @param image 要上传的图片
     * @return 上传结果成功或者失败
     */
    @Multipart
    @POST("/user/avatar/")
    Observable<Result<String>> uploadAvatar(@Part MultipartBody.Part image);
}
